package com.aruba.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Demo2Controller {

    @RequestMapping("/demo5")
    public String demo5() throws InterruptedException {
        Thread.sleep(1500);
        return "demo5";
    }

    @RequestMapping("/demo6")
    public String demo6(Integer id) {
        if (id == null) {
            throw new RuntimeException("异常比例");
        }
        return "demo6";
    }

    @RequestMapping("/demo7")
    @SentinelResource(value = "test_hotkey")
    public String demo7(@RequestParam(value = "hotkey", required = false) Integer hotkey) {
        return "demo7";
    }

}
